Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2UserDataManager = require("UserDataManager");
var $2ByteConstant = require("ByteConstant");
var $2WeChatConstant = require("WeChatConstant");
var $2WeChatTime = require("WeChatTime");
var $2ADManager = require("ADManager");
var def_GameSwitch = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
  }
  babel_createClass(_ctor, null, [{
    key: "requestHttpGetGameSwitch",
    value: function requestHttpGetGameSwitch() {
      var e = this;
      var t = "";
      var a = 0;
      switch ($2ADManager.default.instance.sdkType) {
        case $2ADManager.SDK_TYPE.Byte:
          t = "62eb85d57a6efc2a5c27dbc2";
          break;
        case $2ADManager.SDK_TYPE.WeChat:
          t = "62f310d616f15e45c2b0f26c";
          if (window.wx && 0 == (a = $2UserDataManager.default.instance.scene)) {
            a = wx.getLaunchOptionsSync().scene;
            $2UserDataManager.default.instance.scene = a;
          }
          break;
        case $2ADManager.SDK_TYPE.Oppo:
          t = "6295ad1c1b8d9b425a056305";
          break;
        case $2ADManager.SDK_TYPE.IOS:
          t = "629d79001b8d9b425a070465";
          break;
        case $2ADManager.SDK_TYPE.ViVo:
          t = "625fa58c3509b153b38a1e21";
      }
      var c = {
        id: t,
        sid: a
      };
      console.log("sid==", a);
      var d = new XMLHttpRequest();
      d.open("POST", "https://ga.gametdd.com/adCtrl/agd/conf", true);
      d.setRequestHeader("Content-Type", "application/json; charset=utf-8");
      var h = JSON.stringify(c);
      d.send(h);
      d.onload = function () {
        if (200 == d.status) {
          var _t18 = JSON.parse(d.responseText);
          if (_t18.data) {
            _ctor.version = _t18.data.p1;
            switch ($2ADManager.default.instance.sdkType) {
              case $2ADManager.SDK_TYPE.Byte:
                $2ByteConstant.default.resultInster = parseFloat(_t18.data.p1);
                $2ByteConstant.default.gameBanner = parseFloat(_t18.data.p2);
                $2ByteConstant.default.tryPanel = parseFloat(_t18.data.p3);
                break;
              case $2ADManager.SDK_TYPE.WeChat:
                $2WeChatConstant.default.btnDelay = parseFloat(_t18.data.p1);
                $2WeChatConstant.default.tryPanel = parseFloat(_t18.data.p2);
                $2WeChatConstant.default.mainInster = parseFloat(_t18.data.p3);
                $2WeChatConstant.default.noOperation = parseFloat(_t18.data.p4);
                $2WeChatConstant.default.firstJuzhen = 0 != parseFloat(_t18.data.p5);
                $2WeChatConstant.default.juZhenDelay = parseFloat(_t18.data.p6);
                $2WeChatConstant.default.showIcon = 0 != parseFloat(_t18.data.p7);
                $2WeChatConstant.default.showJuzhen = 0 != parseFloat(_t18.data.p8);
                if (0 != $2WeChatConstant.default.noOperation) {
                  e.videoNode = new cc.Node();
                  cc.game.addPersistRootNode(e.videoNode);
                  e.videoNode.addComponent($2WeChatTime.default);
                }
            }
          }
          console.log(_t18);
        } else {
          console.error("请求api失败!" + d.status);
        }
      };
    }
  }]);
  return _ctor;
}();
exports.default = def_GameSwitch;
def_GameSwitch.version = "";